<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/resource/common.jsp"%> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<%--查询所有角色 --%>
    <title>${title}</title>
	<script type="text/javascript" src="<c:url value='/resource/js/view/role.js'/>"></script>
	
	<script type="text/javascript">
	var ROOT_PATH = "<%=basePath%>";
	$(function(){
		$("#query_form").css({"width":$(window).width()});
		
	window.setTimeout(function(){
	    $("#role1080").hide();
	    $("#role1021").hide();
	    $("#role1101").hide();
	   if(
	      ('1'=='${isadmin}'||'1'=='${iszzb}')
	     )
	  {
	    $("#role1080").show();
	    $("#role1021").show();
	    $("#role1101").show();
	  }
	  },1.5);
	
	$('#test').datagrid({
		iconCls:'icon-save',
		width:$(window).width(),
		height:$(window).height()-42,
		nowrap: true,
		striped: true,
		fitColumns:true,
		url:'<%=path%>/sys/role/list.json',
		idField:'rcode',
		singleSelect:true,
		onLoadSuccess:function(data){
			$(this).datagrid('doCellTip',{'max-width':'300px','delay':500});
		},
		frozenColumns:[[
		]],
		columns:[
		  [	
		  	{field:'rname',title:'角色名称',width:150,align:'left'},
	      	{field:'remark',title:'备注',width:300,align:'left'},
			{field:'opt',title:'操作',width:150,align:'center', fixed:true,
				formatter:function(value,rec){
					return "&nbsp;<a href='javascript:uumsRole("+rec.rcode+");'>编辑</a>&nbsp;"+
					"&nbsp;<a href=\"javascript:uumsRoleEdit("+rec.rcode+",'"+rec.rname+"');\" title='查看人员'>人员</a>&nbsp;"+
					"&nbsp;<a href=\"javascript:uumsRoleResource("+rec.rcode+",'"+rec.rname+"');\" title='查看资源'>资源</a>&nbsp;"+
					"&nbsp;<a href='javascript:uumsRoleRemove("+rec.rcode+")'>删除</a>&nbsp;"
					;
					
	   				
				}
			},
		]],
		pagination:true,
		rownumbers:true
		
	});
	var p = $('#test').datagrid('getPager');
	$(p).pagination({
		onBeforeRefresh:function(){
		}
	});
	
	});
	
	
	
	</script>
  </head>
<body >
	<div>
		<div  >
	    	<form method="post" id="query_form" style="margin:0px;padding:0px;">
<table width="100%" border="0" cellspacing="0" cellpadding="4" style="background:#e9f8ff; border:1px solid #cbd9e4; font-size:14px;">
		    		<tr>
			    		<td class="td_label">名称</td>
			    		<td class="td_text" style="width:200px;">
			    		<input type="text" id="rname" value="${condition.rname}" name="rname" onblur="this.value=this.value.replace(/[^\w\b\u4e00-\u9fa5]/g,'');" maxlength="18" style="padding-top:3px;width:180px;"/></td>
			    		<td class="td_label" style="width:300px;text-align: left;">
			    		<a href="javascript:_goto(1);">查询</a>&nbsp;&nbsp;
			    		<a href="javascript:formReset();">重置</a>&nbsp;&nbsp;
			    		<a href="javascript:uumsRole(0);" style="width:70px;">新增角色</a></td>
			    		<td>&nbsp;&nbsp;</td>
		    		</tr>
		    	</table>
	    	</form>
	   	</div>
	   	<div id="tbl_container" style="font-size:12px;">

			
			<table id="test" ></table>
			
			<%--
	   		<table id="tbl_datalist" class="tbl_datalist" cellpadding="0" cellspacing="0">
	   			<thead>
		   			<tr>
		   				<th class="txt_center" width="35" style="text-align: left;">序号</th>
		   				<th style="text-align:left">角色名称</th>
		   				<th style="text-align:left">备注</th>
		   				<th style="text-align:left">操作</th>
		   			</tr>
	   			</thead>
	   			<c:forEach var="data" items="${page.list}" varStatus="vs">
	   			<tr id="role${data.rcode}" ondblclick="javascript:parent.uumsRole('${data.rcode}');">
	   				<td class="txt_center" width="35" style="text-align: center;">${((page.pageIndex-1)*page.pageSize)+vs.count}</td>
	   				<td><p style="width:150px">${data.rname}</p></td>
		   			<td><p style="width:300px">${data.remark}</p></td>
		   			<td>
		   				<p style="width:120px">
						<a href="javascript:uumsRole('${data.rcode}',${page.pageIndex});">编辑</a>
						<a href="javascript:uumsRoleEdit('${data.rcode}','${data.rname}',${page.pageIndex});" title="查看人员">人员</a>
						<a href="javascript:uumsRoleResource('${data.rcode}','${data.rname}',${page.pageIndex});" title="查看资源">资源</a>
						<c:if test="${1 == isadmin}">
						<a href="javascript:uumsRoleRemove('${data.rcode}',${page.pageIndex})">删除</a>
						</c:if>
		   				</p>
					</td>
	   			</tr>
	   			</c:forEach>
	   		</table>
	   		 --%>
		</div>
	</div>
</body>
</html>